using System;
using System.Data;
using System.Data.SqlClient;

namespace DalatCooking.Core
{
	public class CustomIdentity:System.Security.Principal.IIdentity
	{

        public int UserID { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public string Password { get; set; }
		public CustomIdentity( string email )
		{
			Person user = PersonManager.FindByEmail(email);

            this.UserID = user.PersonId;
			this.Name = user.Profile.DisplayName;
			this.Email = user.Email;
			this.Password = user.Password;
		}

		public CustomIdentity( int userID )
		{
            Person user = PersonManager.FindById(userID);

            this.UserID = user.PersonId;
            this.Name = user.Profile.DisplayName;
            this.Email = user.Email;
            this.Password = user.Password;
		}

		// Properties
		public string AuthenticationType
		{
			get { return "Custome Authentication"; }
		}

		public bool IsAuthenticated
		{
			get 
			{
				// assumption: all instances of a SiteIdentity have already
				// been authenticated.
				return true;
			}
		}		
	}
}
